<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">

	<ui:composition template="/template/template.xhtml">
			<ui:define name="body">
				<h:form id="form-abrir-pedido-credito">
					<div id="div-abrir-pedido-credito" >
						<div id="div-dados-pedido-credito" class="div-dados">
							<ui:include src="/pages/cliente/dados-pedido-credito.xhtml" />
						</div>
						<div id="div-solicitar-pedido-credito">
							<a4j:commandButton action="#{abrirPedidoCredito_mb.solicitarCredito}" 
								value="Confirmar"
								onclick="showLoad();this.disable=true;"
								reRender="panel-dados-pedido-credito, panel-acao-credito" 
								oncomplete="salvarCredito();hideLoad();this.disable=false;"/>
						</div>
						<div id="div-confirmar-pedido-credito" style="display: none;" >
							<a4j:outputPanel id="panel-acao-credito">
								<h:panelGrid columns="3" rendered="#{abrirPedidoCredito_mb.form.valid}">
										<a4j:commandButton  
											value="Novo Pedido"
											onclick="showLoad();this.disable=true;"
											action="#{abrirPedidoCredito_mb.novaSolicitacaoCredito}"
											reRender="panel-dados-pedido-credito" 
											oncomplete="novoCredito();hideLoad();this.disable=false;"/>
										<a4j:commandButton rendered="#{abrirPedidoCredito_mb.form.confirmarPedido}" 
											value="Confirmar"
											onclick="showLoad();this.disable=true;"
											action="#{abrirPedidoCredito_mb.confirmarCredito}"
											reRender="panel-dados-pedido-credito"
											oncomplete="Richfaces.showModalPanel('confirmar-pedido-credito-modal');hideLoad();this.disable=false;"/>
										<a4j:commandButton  
											value="Cancelar"
											onclick="showLoad();this.disable=true;"
											action="#{abrirPedidoCredito_mb.cancelar}"
											reRender="panel-dados-pedido-credito" 
											oncomplete="novoCredito();hideLoad();this.disable=false;"/>
									</h:panelGrid>
									<a4j:commandButton  value="OK"  
											rendered="#{!abrirPedidoCredito_mb.form.valid}"
											onclick="novoCredito();"/>
							</a4j:outputPanel>	
						</div>
					</div>
					<ui:include src="/pages/cliente/panel/confirmar-pedido-credito.xhtml" />
				</h:form>
		</ui:define>
	</ui:composition>
</html>